@model LanLordz.Models.UserCheckInModel
@{
    ViewBag.Title = "User Check In";
}
@section headers
{
  <script type="text/javascript" language="javascript">
    //<![CDATA[
    function CheckIn(userId, checkIn) {
      $("#User").val(userId);
      $("#Action").val(checkIn);
      $("#User").parents("form:first").submit();
    }
    //]]>
  </script>
}
    <h2>@ViewBag.Title</h2>
    @using (Html.BeginForm("UserCheckIn", "Crew", FormMethod.Post, new { autocomplete = "off" }))
    {
     @Html.AntiForgeryToken()
     <div>
      <p>Add an existing user:</p>
      <input id="input_username" name="Username" class="UserLookup" /><input type="submit" value="Check In" />
     </div>
    }
    @using (Html.BeginForm())
    {
     @Html.AntiForgeryToken()
     @Html.Hidden("User")
     @Html.Hidden("Action")
     <table>
     @foreach (var reg in Model.Registrations)
     {
      <tr>
       <td>@Html.UserLink(reg.UserID, reg.Username)</td>
       @if (!reg.Registration.IsCheckedIn)
       {
       <td><button onclick="CheckIn(@reg.UserID, 1)">Check In</button></td>
       <td><button disabled="disabled">Cancel Check In</button></td>
       }
       else
       {
       <td><button disabled="disabled">Check In</button></td>
       <td><button onclick="CheckIn(@reg.UserID, 0)">Cancel Check In</button></td>
       }
      </tr>
     }
     </table>
     <br />
    }
